//
//  NewMemorandum.m
//  ActionsMemorandum
//
//  Created by _LJX on 2017/10/26.
//  Copyright © 2017年 _LJX. All rights reserved.
//

#import "NewMemorandum.h"
#import "SingleModle.h"
#import "UploadData.h"
@interface NewMemorandum ()
@property (weak, nonatomic) IBOutlet UITextView *article;
@property (weak, nonatomic) IBOutlet UILabel *time;


@end

@implementation NewMemorandum



- (IBAction)Save:(id)sender {
    NSInteger i = [_article.text length];
        if(i<15){
            i = i;
        }
        else{
            i = 15;
        }
    NSString *time = [NSString stringWithFormat:@"%@",[NSDate date]];
    NSString *title =[_article.text substringWithRange:NSMakeRange(0, i)];
    NSLog(@"文章标题%@",title);
    NSDictionary *dic = [[NSDictionary alloc]initWithObjectsAndKeys:title,@"title",_article.text,@"article",time,@"time",nil];
//    [_mArr addObject:dic];
    [[SingleModle shareData].mArr addObject:dic];
    [SingleModle shareData].DataCache = [SingleModle shareData].mArr;
    [UploadData WriteData];
    [UploadData ReadData];
    [self dismissViewControllerAnimated:YES completion:nil];
}


- (void)viewDidLoad {
    [super viewDidLoad];
//    _mArr  = [[NSMutableArray alloc]init];
    _time.text = [NSString stringWithFormat:@"%@",[NSDate date]];
    for (NSArray *arr in [SingleModle shareData].DataCache) {
//        [_mArr addObject:arr];
        NSLog(@"every%@",arr);
    }
//    NSLog(@"new%@",_mArr);
    

    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
